""" 
    twExtJS - ToscaWidgets wrapper for ExtJS (see http://extjs.com)
    
    Distributed under the terms of Lesser GNU Public License.
    
    (c) 2007 - Ricardo Girardi Sixel 
"""

from toscawidgets.widgets.extJS import Panel
from toscawidgets.core import Widget
from toscawidgets.widgets.extJS.core import Component
from toscawidgets.widgets.extJS.util import Observable
from toscawidgets.widgets.extJS.util import BaseWidget


class GridColumn(Component):
    template = "mako:toscawidgets.widgets.extJS.templates.grid.gridcolumn"
    header = "header"
    dataIndex = ''
    width = 220
    editor = None
    allowBlank = False
    name = ''
    params=['header','dataIndex','width','editor','allowBlank','name','isId','gridName']
    isId = False
    gridName=''
    
class ColumnModel(BaseWidget):
    """ ColumnModel """ 
    template = "mako:toscawidgets.widgets.extJS.templates.grid.columnmodel"
    columns = []
    name='columnmodel'
    params=BaseWidget.params | frozenset(['name','columns'])
    

class GridPanel(Panel):
    """ GridPanel wrapper """
    template = "mako:toscawidgets.widgets.extJS.templates.grid.gridpanel"
    params=['cm','ds','width','height','autoExpandColumn','title','frame',\
            'plugins','clicksToEdit','renderTo','selModel','viewConfig' ]
    cm=None
    ds=None
    width=600
    height=300
    autoExpandColumn = ''
    title=''
    frame=True
    plugins = "" 
    clicksToEdit = 1
    inFieldSet = False
    selModel = None
    viewConfig = '{forceFit:true}'

    
class EditorGridPanel(GridPanel):
    """ EditorGrid """
    template = "mako:toscawidgets.widgets.extJS.templates.grid.editorgridpanel"
    params=GridPanel.params | frozenset(['saveUrl'])
    saveUrl=''


class AbstractSelectionModel(Observable):
    pass
    
class CellSelectionModel(AbstractSelectionModel):
    pass

    
class RowSelectionModel(AbstractSelectionModel):
    pass
